package com.jmga.ecogasfinder.activities.gasstation;

import java.text.SimpleDateFormat;
import java.util.Locale;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import com.jmga.ecogasfinder.R;
import com.jmga.ecogasfinder.providers.GasFinderProvider;
import com.jmga.ecogasfinder.vo.GasStation;

public class GasStationDetailsActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		GasStation gasStation = (GasStation) getIntent().getSerializableExtra(GasFinderProvider.KEY_STATION);
		Log.d(getClass().getName(), "GasStationDetailsActivity onCreate: GasStation-data-received " + gasStation);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.gas_station_data_view);

		TextView text = (TextView) findViewById(R.id.labelText);
		text.setText(gasStation.getLabel());
		text =  (TextView) findViewById(R.id.operatorText);
		text.setText(gasStation.getOperator());
		text =  (TextView) findViewById(R.id.addressText);
		text.setText(gasStation.getAddress());
		text =  (TextView) findViewById(R.id.laneText);
		text.setText(gasStation.getLane());
		text =  (TextView) findViewById(R.id.postalCodeText);
		text.setText(gasStation.getPostalCode());
		text =  (TextView) findViewById(R.id.sentTypeText);
		text.setText(gasStation.getSentType());
		text =  (TextView) findViewById(R.id.saleTypeText);
		text.setText(gasStation.getSaleType());
		text =  (TextView) findViewById(R.id.xCoordText);
		text.setText(gasStation.getXCoord());
		text =  (TextView) findViewById(R.id.yCoordText);
		text.setText(gasStation.getYCoord());
		text =  (TextView) findViewById(R.id.localityText);
		text.setText(gasStation.getLocality());
		text =  (TextView) findViewById(R.id.provinceText);
		text.setText(gasStation.getProvincie());
		SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
		String dateString = sdf.format(gasStation.getDate());
		text =  (TextView) findViewById(R.id.dateText);
		text.setText(dateString);
		sdf = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
		dateString = sdf.format(gasStation.getDate());
		text =  (TextView) findViewById(R.id.hourText);
		text.setText(dateString);
	}
	
	@Override
	protected void onDestroy() {
		Log.d(getClass().getName(), "GasStationDetailsActivity super.onDestroy()");
		super.onDestroy();
		
	}

	@Override
	protected void onPause() {
		Log.d(getClass().getName(), "GasStationDetailsActivity super.onPause()");
		super.onPause();
	}

	@Override
	protected void onRestart() {
		Log.d(getClass().getName(), "GasStationDetailsActivity super.onRestart()");
		super.onRestart();
	}

	@Override
	protected void onResume() {
		Log.d(getClass().getName(), "GasStationDetailsActivity super.onResume()");
		super.onResume();
	}

	@Override
	protected void onStart() {
		Log.d(getClass().getName(), "GasStationDetailsActivity super.onStart()");
		super.onStart();
	}

	@Override
	protected void onStop() {
		Log.d(getClass().getName(), "GasStationDetailsActivity super.onStop()");
		super.onStop();
	}

	@Override
	protected void onRestoreInstanceState(Bundle savedInstanceState) {
		Log.d(getClass().getName(), "GasStationDetailsActivity super.onRestoreInstanceState()");
		super.onRestoreInstanceState(savedInstanceState);
	}

	@Override
	protected void onSaveInstanceState(Bundle outState) {
		Log.d(getClass().getName(), "GasStationDetailsActivity super.onRestoreInstanceState()");
		super.onSaveInstanceState(outState);
	}

}